split out dialog handling, test