refactored bibtex handling