Updated api docs, and marginally improved error reporting