Replace exit() with sys.exit() and unify the exit point

"exit is a helper for the interactive shell - sys.exit is intended for
use in programs." Refer to: http://stackoverflow.com/a/6501134
Merge pull request #2 from changyuheng/pr_refactoring

Replace exit() with sys.exit() and unify the exit point