add function stats to generate statistics for a given AI p
use pmap to make use of multiple cores
remove unused fail-count