refactoring compelte