refactor code,rename the PageState