Refactor transformPipe.