Added detection for already running instances of the script.