Optimizations in message passing