Programming Assignment 2 - My solution