refactor IR