added support for different document formats