Abstract a common query for all functions to use, so that we get the same data and ordering across all calls.