Why an if around the while-loop? It would skip the while-loop if the list.length was 0.