Refactor and add additional tests for paginated content