Removed unused imports.
Added popup dialogs for error cases.