Added support for dialog. Functionality may not be 100% complete, but it is quite usable.