fixed some typos + fixed the while loops