Adjust for modual dialog, add events dispatching.