handle pagination and events