Modify scripts for function