Bug fix: Additional break from loop added as certain conditions cause infinite loop.