Refactoring code and latex.