added the overflow halt switch and made a few adjustments