page repairer code refactor