abstracted all querying into separate function. Need to get async return working