Programming Assignment 3 2nd iteration