We identified the original logic, and Sergey proposed solutions that were more correct and quite easy to understand in everything.
As a result, a work decision was made. What we need, we will use.
It was a little out of time, but it also depended on us. It was not enough time to check.