Add error handling, breaking some of the types

Would it be useful to have an example usage here?