Fixed extra clearInterval causing loop to end prematurely