add initial tree js, make it much more flexible