moving from mod to rem since it's faster.
more aggressive optimizations.
prob 12 working.