Completed code for project 4