MessageService class modified