moved OFFSET and LIMIT to global variables