Enhancing a dialogue system through dynamic planning