Updated index.php with extra functions