moved query into dataFunctions

made functions in there to perform db.query