Improve span handling.
Clear error message when document file has not been specified.