Improved error reporting. And bug fixes.