Updated the While Loop and included a Nested Loop.