Several improvements to the API.