homework 4 --final version