improve PEP8 style

I added one extra blank line between top-level functions. The official Python style guide PEP8 recommends this for some reason. I also changed the exit() calls to sys.exit(). exit() is intended for the interactive interpreter only.