Modifies Problem #3
Solves Problem #5