replace use of 'setTimeout'