Adding code from lecture 6. Now going home kkthxbai.