Final version submitted for HW3.