Function script

The function now has its own script.