Attempt at Programming Assignment 2