moved dwell time to the begining of the function, so the if clause will not cancell...