Refactored code responsible for TeX processing.
Removed old code.