Moved setInterval to seperate function to avoid recursion.