refactor onPage