Solves problem #15.