useful code from classmates