Document programmatic api. Fixes #69, #65.