Add option parsing.

Got a working option parser. Rough around the edges. (Needs test suite)