Finished part 3 code.