Refactoring more stuff