refactoring code, part 2
merge