start refactoring
refactoring part2, to be continued