just double checking: it's not immediately obvious that this loop always ends, but i guess it's always the case, right?