added error dialogs and sanitize input in config,

refactor and cleanup