Code for Part 5