created and doscumented functions per assignment instructions