Deleted duplicate code
query tree implementation