improved tags insertion