* added synchronization to avoid thread problems
* modified script generator to require that the trialLength be at least   
  2.5 seconds longer than the three intervals so that the fish is on the 
  screen for at least 2.5 seconds....)
* cleaned up the code