refactoring Code