API change: defer everything to the callback

Makes it easier for use for the user to use the library, because the user now has only to do error checking in one place instead of two. 

Discussion: #829