Added flexible dialog support. That is dialogs with width and height depending on content