Based on lecture notes.