Improved error reporting. Closes #10