Better error handling and cleaner output of script results.