I don't understand what this function is supposed to do, and the name `whileloop` doesn't help. Can you add some comments, or give it a more meaningful name? (or both)