updated window function