added some usability, but still need to fix tree writer