Optimize overlap_math by only doing shifting if theres gain, and moving the check...