Final version of Problem 6