Changes loop to make faster