Remove all breakable and modify for loop to while loop (Yu-Ting)