Making the API a bit more robust