Rewrite in WPF + Undo Function