working version of Programming Assignment 2