going to refactor heavily, checkpointing