updated for table pagination