Original code submitted in class September 2012