Code refactoring

Code refactoring