encode and decode both work for the large tree