Some more refactoring, program compiles