Rearranged parse loop to go over TD elements.