Solving problem 16