Modularize implementation and specs related to pagination