simplified some window rect calculations