converted conversation implementation to use trees