added functions for queries