added checkpointing