Major fixes in filtering out unneeded windows.