Moved pagination to new file
Fixed errors related to pagination