nit: I still think this doesn't belong in the router file, though I'm fine with the function name and location.