refacto dialog