Major rework on modal dialogs