adding code for reduced trees