Simplify probability code