Added threshold time parameter