reduced memory consumption, added argparse
minor fix