implemented tag handling