My solution for ProgrammingAssignment2