My solution to ProgrammingAssignment2