documentation and for to while loop conversion