Implement new document loading API.