refactor kie