Some sweet refactoring