Rewrite of appendTags function