completed up to HW1 Problem 4