code from exam 1