refactor on two pages