refactoring, tests still broken