Code from Lecture 6