simplify and generalize statsModule