Try to fix KF in all compilers (one more time!)

And partial factorization of KF code in two files for clearness.