Added confirmation dialogs, some code cleanup