Handle different kind of messages