Fairly strong re-org of code.

Includes some API changes, so bumped version number.