For Programming Assignment 2, attempt 2