Changed to single loop