moved route adding to its own function