code from lecture 5 examples