non-recursive mod and range