refactoring code.