Sorry, this only works if you don't edit the values (len=0, I guess).
But see my comment on your gist