Made the p-value computation less memory intensive