Implemented the functions per assignment instructions.