functions completed as per assignment requirements