refactor common.js down to just the pageload function