change functions to file scope