refactor routes and index adn controller