Added the more general form. An even more general one would take an offset, but it's probably not a very common need.