Updates to query to make pagination far more friendly.