moved the creation of the PofValue outside of the query loop