Completed through exercise 4 of Polishing Ruby