put the new functions to lib.php