minor tweak
refactor
better error reporting
better api example