QDR and TreeH prototypes

Added a dialog system and some code cleanup.