changed timeout function