moved setting of onScrollListener to main function

- also added offset as totalItemsCount, not page number