Bug fix, movement detection logic change

Remade the movement detection logic such that it doesn’t call
startAlarm() multiple time for the same movement.