Add max, min, exclude, include and sort to queries