complete refactoring