improvements to refactoring