adding encoder Code