handle paging

I tried to implement paging, next page when necessary. Feel free to use it.