refactors routes