Make argument parser more functional & various code cleanup

Hey @squito,

I just reviewed the original code and made various small improvements here and there. Mostly small stuff (nothing feature-wise). I did basically rewrite the core of the argument parser to be tail-recursive and more functional. I think it might be easier to reason about the code in this way. All of the tests pass. Feel free to merge it all in or whatever you think is best.

Cool stuff, for sure!