turn routes into a function