Encode part improve