changed while loop condition to the 1 i prefer