finished HW3-3 and 4