added argparse ed lot of changes in input + output format