added threshold for better accuracy in analog events