Working code with loop for all sites