Slides from Lecure 4 plus source codes.