trim str only
handles tags in array
minor fix
minor fix