Revised HW5

Revised based on Bei Zhang's slides.