Format imports according to pep-8. Fix parsing arguments by using argparse. Add couple comments to the code.

Hi,

I've started looking at the code and added few items that I believe would make it easier to look at the code for the first time for anyone else.