replaced all vars with functional vals; created method to perform document processing