massive update to logic, new concept of RangeGroups so underlying html remains as valid as possible