added function for dialog box to handle cancel button"