Better handling of arguments

Moved the handling of arguments from a local
implementation to argparse which is provided by python.