Added undo redo factory

The factory is used to create undo and redo stacks.