Refactoring distance between pages