modified plain kf and add test code