Updated tree writing mechanism