Remove use of sys.exit