Refactors router