first-pass implementation of dialogtree