Refactored encoding transform.