Moved common function to lib_vara.php