move probabilities reading to own function