Clear spaces around tags; ensure uniqueness