handle all types of messages