Adding part1 and part2 of tutorial series code and refactoring.