Refactoring boilerplate