Fixed typo and removed while loop