working refactoring