Integrating speltree and endings code