some of the code for consensus and MBR decoding