add chan, tree and new demo code