code refactoring

code refactoring