changed setInterval with setTimeout