adding while loop