refactored pageation listener.