Part 3 code