move Dialog implementation to global context for re-use