implemented query execution