refactoring code, part 1
refactoring code, part 2