Completed the assignment with the code for the functions.