Use getopts_long for argument value parsing

Also: - accept `threshold` values from argv
- better error messages
- better interface