Same fundamental ideas, but I got a lot of things wrong in that earlier version (which is several years old now).