removed setTimeout function from previous version