Reimplement context locals from scratch.  #2