Added initial pagination logic