refactor training