use tagnames a bit more smartly