fix performance penalty by removing the building of the grouplist out of the iteration