Change from min/max to windowing algorithm