final refactoring before part 2.