Right before adding recent changes from Mars

Relatively standard implementation, works for ENTS, no benchmark
evaluation code.