Rework options parsing and error handling