DocumentSource logic