new message passing framework + tested on categorical factor