Code  refactoring