Refactoring index.php