added functionality for queries