Moved facts code to helper function