Added main loop to index.php