Split out route management to separate JS.