Fall back to the non-coprime method if we don't have enough bits for the coprimes.
Lots of tidying up.
Only calculate the modified offsets if we're acually going to use them.
Refactor the coprime code.
Tidy up some whitespace.