rework of encoding into object paradigm
added destructor
updated with test fixed
updated signatures
Merge pull request #44 from AlexsJones/encoder

updated