Some of the strange code with mod in this discussion is to compensate for the, uh, interesting behavior of the Revolution mod function with negative numbers. If one's application elsewhere just happened to use knuthMod(), defined on page 38 of _Fundamental Algorithms_, then the math would be simpler and easier to read if that function was used here. Dar Scott