Code for Week 7 Lecture.