Add undo stack management library

Closes: #4