Prepared user interface and partly backend for undo/redo support.

Signed-off-by: Jakob Brandsborg Ehmsen <jakobehmsen.github@gmail.com>