Start split of ed functionality to lib