add pair and encoding