extract method, introduce MAX CHUNK SIZE const with 999 (reduce this by the number of additional query parameters), fix whitespace