refs #5693. Fixed dialog box bug.
Refs #5693. Tidied up method.