refactoring controllers/index.php