Getting rid of the redundancy in runcollatex.py