refactoring kevscript