Add delay to avoid false alarms, plus…

  - Remove some magic numbers and replace with meaningful constants.