move methods,types to tree-util.scala