NEW STABLE--BEST VERSION

corrected modulo moves calculations