improvements to the codec and mine logic.