Minor improvements

Now strips invalid tags from source string