refactor routes views and models