Make line reset character counter to 0.
Use $t1 as the iterator properly.