solved problem 3 badly