Generalized to arbitrary monoids