Solution for #3.