Solution to the ninth challenge