refactoring code
merged