Can you make this a more general function and put it in utils?  We might use query params for something else eventually.