slight mods to end of lec 7