partially complete refactoring