make prob computation more efficient