I'm not a huge fan of passing in a array in order for it to be updated by reference. I think a function that returns the query would be cleaner, and it can be pushed into the queries array in the calling function.