added modules for subwindows, beautified key dispatcher