recovery: reworked iteration

Also added TODOs and code stubs for sort, diff and recovery.