Major cleanup in index.php