more refactoring. debug compiles now