Added code from lecture 2 video.