Simplified getting the lmid value to improve performance and reduce code complexity.
Slightly improved message processing.