Proper error handling and exiting.