Fixing some bugs and timing issues with the script.