UI Improvements

bug fix on undo/redo
auto calculate window size