Better window memory management