First solution to ProgrammingAssignment2