Changed around loopy belief propagation algorithm a little bit.