updated p-value calculation