Improved error handling - the work in progress.