Solves problem 16
Solves problem 17