ugly solved problem 5