A flexible mechanism for dialogue design