Completed assignment. Added comments and code for the two functions.