mgj : working encoder/decoder
mgj : several tests added