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