building checkpoint logic