Programming Assignment 2 with minor changes