Consolidate some route handling functions.