Window optimization incorporated

for now it extends the window so that it includes all points