Add old dlg code I found somewhere