added functionMonoid and bag