updated for query