Improvements to lecture 3