Programming Assignment 2 Version3 with comments added