Completed problem 5.1