tools: improvement to table builder and new reference toc builder