Added tree printing function