Attempted refactoring