Replaced ForEach with loop, moved Trim outside.