Improved handling of tags.