encoder code added