Added some features to query tool