externalizing time and delay
all millis() replaced with ticks.millis()