Added some functions to index.php