Extracting duplicate code to helper methods.
Config settings to disable index optimization/range calculation

Introducing two configuration parameters which allow users to disable
index optimization and range calculation during index cycling.
Also introducing configuration tunable which defines the maximum number
of segments during index optimization, defaulting to 1.