refactoring for Wiz port; random cleanups