refactoring like crazy