Adapted tree from Jellybean