I'd suggest replacing the whole body of this case by `super.transform(transformFunction(fun))`, and moving the bookkeeping done here to `transformFunction`.