While loop should now work as intended.