Added 'break' to reduce useless neighbor checking.