Copied kbmira hope/fear code to HFDecoder