Moved the worst check to real location in main, messed around with
functions use of grid to fix errors that arose with delayed solving.