Functions for the ProgrammingAssignment2 are ready