added while loops