Modified the temporary exit IF statement to allow for both ESC and ALT_F4.

Changed two for loops to enhanced for loops.
Noticed slight performance improvement due to this change.