Argparse + File handling

Added argparse support and better file handling