working through entire document