query limiting implementation