added printouts
added function to write temp tree