big crazy refactoring