add dec and enc functions