improved problem 31 and code cleanup

Finished cleaning up code for now and made it so problem 31 uses the
Problem interface