move timeout handling outside the sequence