I've just pushed the new implementation up to here