Add rudimentary argument processing.
Document error paths better.
Semi-working code.