eliminate useless tags and codify restrictions