corrected a bit and wrote pearsons formula