added while loops to repeat commands