Hmm, maybe not. Cn you please add some comments to `def transform`? It's not obvious to me yet what's going on.