lecture 8 code