Lecture08: updated, complete solution