updated for lecture 9