refactor checkpoint