Refactor batch handling and locking.
Remove preview method.
Add persistent lock backend.