code refactoring

Code refactoring