Added a dialog function to make the dialog less time-consuming to program.