Improved offset/limit logic by moving it after sorting
Added version in the header