Updated for problem 5