updated encoder decoder