refactor page controller