updated paginated post code