Added timers to wait after sensor is activated and to wait before starting the optimization.