Final Submission with comments

This is the completed functions with all the comments added.