code refactoring part2