more exact checkpoint detection
removed some redundant code