Optimized trimming of message