even heavier refactoring; organize imports