Perhaps just put the code after this point into an if-block. It's more indentation, but since this script does several different things it would be easy to add one more and not realize that the script can cancel out early.