added fact function

please accept PR