forward-backward algorithm changes