Some refactoring along with the addition of the -d option for explicitely specifying the directory of the LaTeX project.