Fixed typo in previous version
Handles --save-masks

Changed a number of dialogs to alerts. More robust error handling.
Handles —save-masks