Minor rfactoring on Dialog