Rewrote negative shift detection logic, fixing a bug that resulted in unreliable negative shift detection (failed ~1/10 times)