Cleanup work in pattern transformations.