Refactors router and views