getopt-based implementation functional but needs more testing