Add code for while loop handling.