add support for the Embed endpoint
fix issue with error handling
add unit tests