extremely annoying bug: modulo didn't work. Replaced by fmod