Rest of the refactoring