Merge api branch, which contains a complete API overhaul.

Fixes issue #4.