Code to make the script optimizer work