Refactoring almost everything