refactoring continued - compiles for the first time in days