Second encode/decode state now handled by finish functions