Yeah, but with math mod and not programmers mod. This code has to handle -1 % 5, which should be 4, not -1.