Some improvements to the api