Parse args before checking them
Added tests, incremental refactor