Rework pinning with case alternatives. No functional changes.