process of encoding 2 types