...G...... [ZBXNEXT-497] corrected algorithm