Solving problem #3