change functions to script local