Refactor router and views