HW1: Problem 4 finished