added corpus prob function