Code from Lecture 7
Code from lecture 8