The implemantation of tree

The current version is immature and need improving!