Part 2 code