Built a flexible statistics factory.