replaced sys.exit with raise Exception()