My version of the two functions for Assignment2