added deleted and abstracted functions so that new query types can easily be added