Improvements to matching on functional terms.