finished and commented on code for video 31