fiixed some potential inefficiency
let dialogs dispose on close
removed an unnecessary function