Since this is replicated in 4 places, this could be replaced with a 2 line function. I chose not to go that route because the structure of the query could change in the future. Thought it would be better to just be explicit here... lmk if this is dumb