mega refactoring, splitting and stuff