Refactored action parsing to help fn.
Plugged in last part of checkpointing.