Revised index.php & logic.php files