remove code duplication. use Tag.subst