Improved error handling
Merge...