Solution for #1.