Reorganized large parts into their own libraries

Made undo-tree compatible with redefined left/right