Changed code per assignment instructions