added function to infinite scrolling