refactor keyvalue --> fact