for (int x=0; x < 150; x++) { // Wait for 1 second
delay(1); }
This is functionally identical to:
delay(150);
The only way is to have the loop around the ENTIRE code - which is what the loop() does anyway - and make decisions about what should be done depending on historical events - i.e., store values in variables that don't get erased and look to see what happened in the past.
I.e., the state machine I mentioned earlier.