more refactoring complete