Changed pattern to use setTimeout instead of setInterval