jedi code refactor