First version of trees working