Added algorithm stuff to find illegal mod bits