Ok it loooks like the my forgot to add the T2 in the second last line - cos should also have a T2 in front of it.
from this, split the fraction with the plus - tan theta = (mg/T2cos theta) + (T2sin theta/T2cos theta) and simplify
I remember doing this question last year - not fun.