Removed unneeded while loop