Not looked into the code itself - but this function closes two table rows, but never appears to open any. Is this correct?