better error handling and reporting.
Merge branch 'rwcarlsen-errors' into develop