added countTotalNumberOfReactions function