A......... [ZBX-6174] Improve code structure and style, add more comments.