working nscoder encoding