Modified solved problem 3