Added a unittest for main(), changed sys.exit() calls to return 0.