subwindow init

subwindow implemented, but very dirty, because of dirty initial code.