Range to subranges logic.