use setTimeout instead of setInterval