refactored; added temp doc dump