checkpointing. this builds, haven't tested