Max value in a window implemented