add more documentation and add support for offsets