changed timeout to use cydelay