Using functions in scripts