refactoring half way