Improve error messages. Closes #4