adding in problem 4's solution