Added output-to-file to CTC. Optimized tagaffinity.