Programming Assignment 2

Revised after reading TA community discussion post on
https://class.coursera.org/rprog-009/forum/thread?thread_id=164