Added sliding window functionality.