Modify query method