Use faster euclid modulus implementation

This is a more reasonable (mathematically) but equivalent definition of the euclid modulus algorithm. It's a tiny bit faster as well

http://jsperf.com/modulo-comparaison/2