Clean up code that generates new pages trees from existing page trees.
Add additional documentation and choose more meaningful function and member names.