First attempt at the solutions for Programming Assignment 2