typo
replaced handmade args parsing by argparse
add ability to write result in a file