organize program with while loop