Fixed the Endless loop bug noted on the trello board