...G...PS. [ZBXNEXT-101] minor code improvements, changed location of several functions