Move setInterval in to the correct place