Refactor page.d