modified ui logic for paging.