Use greasemonkey para adicionar HTML antes da tabela

Estou usando o greasemonkey para editar uma página. Preciso adicionar minha própria tabela entre as duas que já estão na página e remover a segunda tabela. Não há realmente nada separando as duas tabelas existentes, por isso estou tendo problemas com a funçãoinsertBefore.

<h3>Table 1</h3>
<table class="details" border="1" cellpadding="0" cellspacing="0">
<tbody><tr>
<th>1</th>
<td>2</td>
</tr> 
</tbody></table>

<h3>Table 2</h3>
<table class="details" border="1">
<tbody><tr>
<th>1</th>
<td>2</td>
</tr><tr>
<th>3</th>
<td>4</td>
</tr> 
</tbody></table>

Eu achei o código abaixo útil na remoção da tabela 2, mas preciso adicionar minha própria tabela antes da tabela 2 primeiro:

// find second <table> on this page 
var xpathResult = document.evaluate('(//table[@class="details"])[2]', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null);
var node=xpathResult.singleNodeValue;

// now hide it :)
node.style.display='none'; 

questionAnswers(1)

yourAnswerToTheQuestion