Part 1 of the final class exercise