Prevent downgrade to < K3.0.0
Remove few local static variables to allow multiple uses of the function