Added prepare statements to filter offset