added dialog function