Tree writing correctly
Rewrite