Make encoder library stateful
Merge pull request #78 from cogmission/statefulencoder

Make encoder library stateful