Table function

Wrote another table to count the position of each instance of the table
tags. Putting them into an array so the location to insert the closing
table tags can be determined! Hooray! Took bloody ages, right old
difficult thing.