Moved clique counting process to separate function.