split fetchFromDoc function