Refactor bibtex stuff.