Refactor to modal dialogs