updating messaging module for better testability