updated updated collectFunction