added polyfit into main control loop, all negative fits not working correctly