More refactoring, some things are currently broken