wrap calls into function
remove while loop
fix typo