refactor views and routes