Added a break case in the while loop