Implemented undo (use menu or ctrl + z). Fixed some subwindow stuff.