Overhaul of window management. Sort of working now.