Cleanup interface somewhat, add API example.