new version with saving the messages in the file
ticket: 22843652530556/22843652530560