Rewrote options parsing functions.