Second version of Programming Assignment 2