lots of refactoring to support page tab and canvas pages cleanly