Refactor ChunkStepControllerImpl to fix Bugs 6457, 6456, 5873, at least part of 5875 and some other small changes.