Changed exit() to sys.exit()