First attempt at Programming Assignment 2