might need to rewrite using gnu getopts instead of arg matching