add extensive error reporting (closes #6)