Deselection onwindowclose added. Various bugs removed.