modified pattern to support probabilities functions