Split the script into two functions to see if that allows independent updating