This should provide slightly more accurate (and non-overflowing) logic.