Doing lots of stuff to get pagecontext.  Break up later and add tests