refactor: moving page processing into utils