Update documentation and added test cases for query()