refactoring only made it loads worse