refactored probability functions