Exercise 18: Cleaning up the Code