Refactored code, time-windowed added.
Glitch in time-windowed