added method that returns  the array of messages (this can be used in gui)