refactor ktest