tag cleanup and validation