Moved start code to function.
Replaced code in tagcount for sliding window calculations.
Now storing counted timestamps in db.