This should not be done inside the foreach() loop