Same while loops are unnecessary unless I am missing something