Merged the Tag code with updated database code