WIP. Added context to dpage.  Code cleanup