Cleaning up the while loop for a better representation. Threw 3 lines of code