part 1 refactor