Slightly smarter encoding switching