Refactor stripRemoveTags to use simple foreach iteration