Changed probability calc. function