Make python 3 compatible, fix typo
untabify, use argparse instead of global vars.
rewrite