refactor. add asynchronous batch querying.