implemented windowed function