added ability to only look at the last x number of seconds