Functions for programming project 2