f(x) = sin(csc x -tan^2 (2x))

f'(x) = cos(csc x -tan^2 (2x))[ -csc x cot x -2 tan(2x)(sec^2(2x))(2)]

Why in the secont line is it 2tan(2x) instead of sec^2(2x)? cos is the derivative of sine and -csc(x)cot(x) is the derivative of csc x. Is it that the derivative of tan^2(x) is just like taking the derivative of x^2 but where x=tan(x)?