middle of work
Version with open document, problem with the functions undo and blame. Dunno why. Be careful I changed their prototype it may change other stuff.