[ZPH/MPS] [62257272] Protects against classes having trailing space

Strips leading and trailing spaces from classnames.
Joins classnames in a more robust manner (join rather than gsub)