attempted refactoring