Bug fixes and improvements to the API.