Add --json mode, test file, and use argparse