Move window.setInterval to $interval