refactor the tag functionality
refact the tag functionality