Fixed while loops inside of while loops