massive refactoring, fml