adding latest query code