matched td indexes to correct elements