added global couter to encoder, changed encoder.c to .cpp, ssi working
removed unused variables