enhance robustness and messaging for command-line usage