Refactor the page_wrapper module to pull the node and context checks into a separate function.