move to log probabilities to avoid underflow
fully test path