refactoring options parsing for clarity