rearranged var naming after while loop