Add functions for backwards message calculations and hidden mode sequence inference.