updated with lecture 9