Solves Problem #2.