add checkpointing