encoder functions updated