Added on message received handler.