Moved the .empty outside the .each