added error handling, undo/redo and basic executing