Use sys.exit instead of global