function freeze(address _to, uint64 _until) internal {
require(_until > block.timestamp);
bytes32 key = toKey(_to, _until);
bytes32 parentKey = toKey(_to, uint64(0));
uint64 next = chains[parentKey];

if (next == 0) {
chains[parentKey] = _until;
return;
}

bytes32 nextKey = toKey(_to, next);
uint parent;

while (next != 0 && _until > next) {
parent = next;
parentKey = nextKey;

next = chains[nextKey];
nextKey = toKey(_to, next);
}

if (_until == next) {
return;
}

if (next != 0) {
chains[key] = next;
}

chains[parentKey] = _until;
}